package com.sky.controller.admin;

import com.sky.result.Result;
import com.sky.service.ShopService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


@RestController("AdminShopController")
@Slf4j
@Api(tags = "管理端店铺相关接口")
@RequestMapping("/admin/shop")
public class ShopController {

    @Autowired
    private ShopService shopService;
    @PutMapping("/{status}")
    @ApiOperation("设置营业状态")
    public Result setShopStatus(@PathVariable("status") Integer status) {
        log.info("设置店铺营业状态为：{}", status==1?"营业中":"打样中");
        shopService.setShopStatus(status);
        return Result.success();
    }

    @GetMapping("/status")
    @ApiOperation("管理端获取店铺营业状态")
    public Result getShopStatus() {
        Integer status = shopService.getShopStatus();
        log.info("获取店铺营业状态 {}", status==1?"营业中":"打样中");
        return Result.success(status);
    }

}
